//---------------------------------------------------------------------------
#ifndef fcn_tablesH
#define fcn_tablesH

#include <math.h>

class FnTable
{
private:
    static FnTable *self;

    FnTable();
    void Pow2PowInit();
    void Exp255Init();
    void Exp5Init();
    void Asin255kInit();
    //void PowTextInit(int blur, float power);

public:
    static FnTable *instance() {return self? self: self=new FnTable();}

    // inline don't work BLJAD!!
//    inline int pow2Pow(int x, int y) const {return Pow2PowTable[y][x];}
//    inline int expNeg10NotX(int x) const {return Exp255Table[x];}
//    inline int expNeg5(int x) const {return (x<1001)? Exp5Table[x]: 0;}
//    //inline int powText(int x, int y) const {return PowTextTable[x][y];}
    static int isqrt(unsigned long x);

    static int Pow2PowTable[81][1001];
    static int Exp255Table[3001];
    static int Exp5Table[1001];
    static int Asin255kTable[20001];
    //static int PowTextTable[5][5];

    //Q_DISABLE_COPY()
};

#define FN_POW2POW(x, y) (FnTable::Pow2PowTable[y][x])
#define FN_EXP_NEG_10_NOT_X(x) (FnTable::Exp255Table[x])
#define FN_EXP_NEG_5_X(x) ((x<1001)? FnTable::Exp5Table[x]: 0)
#define FN_ASIN_255K_X_DIV_X(x) (FnTable::Asin255kTable[x])

//---------------------------------------------------------------------------
#endif

